/**
*@note Copyright 2012-2022 CETHIK All Rights Reserved.
*@brief 观测数据类文件 
*@author tuyinan
*@data 2022-04-xx
*/

#ifndef COSTMAP_2D_OBSERVATION_H_
#define COSTMAP_2D_OBSERVATION_H_

#include <costmap_2d/msg_struct.h>

namespace costmap_2d {

/**
*@brief 观测数据类型
*@author tuyinan
*@version 2022-04-xx
*/

class Observation {
 public:
/**
*@brief 构造函数
*@param 无
*@return void
*@author: tuyinan
*@version: 2022-04-xx
*/
  Observation()
      : cloud_(new costmap_2d::PointCloud()),
        obstacle_range_(0.0),
        raytrace_range_(0.0) {}
/**
*@brief 析构函数
*@param 无
*@return void
*@author: tuyinan
*@version: 2022-04-xx
*/
  virtual ~Observation() { delete cloud_; }

/**
*@brief 构造函数
*@param costmap_2d::Point& origin 机器人位姿
*@param costmap_2d::PointCloud& cloud 点云数据
*@param double obstacle_range 障碍物最远范围
*@param double raytrace_range 激光最远范围
*@return void
*@author: tuyinan
*@version: 2022-04-xx
*/
  Observation(costmap_2d::Point& origin, costmap_2d::PointCloud& cloud,
              double obstacle_range, double raytrace_range)
      : origin_(origin),
        cloud_(new costmap_2d::PointCloud(cloud)),
        obstacle_range_(obstacle_range),
        raytrace_range_(raytrace_range) {}

/**
*@brief 复制型构造函数
*@param const Observation& obs 观测数据
*@return void
*@author: tuyinan
*@version: 2022-04-xx
*/
  Observation(const Observation& obs)
      : origin_(obs.origin_),
        cloud_(new costmap_2d::PointCloud(*(obs.cloud_))),
        obstacle_range_(obs.obstacle_range_),
        raytrace_range_(obs.raytrace_range_) {}

/**
*@brief 构造函数
*@param double obstacle_range 障碍物最远范围
*@param double raytrace_range 激光最远范围
*@return void
*@author: tuyinan
*@version: 2022-04-xx
*/
  Observation(const costmap_2d::PointCloud& cloud, double obstacle_range)
      : cloud_(new costmap_2d::PointCloud(cloud)),
        obstacle_range_(obstacle_range),
        raytrace_range_(0.0) {}
  /// 机器人位姿
  costmap_2d::Point origin_;
  /// 点云数据
  costmap_2d::PointCloud* cloud_;
  /// 障碍物最远范围和激光最远范围
  double obstacle_range_, raytrace_range_;
};

}  // namespace costmap_2d
#endif  // COSTMAP_2D_OBSERVATION_H_
